'''
Created on 29/09/2012

@author: Christian
'''
import os.path

class Repository(object):
    
    def __init__(self, path, projectname, repotype):        
        
        if self.__class__ == Repository:
            raise NotImplementedError, "Cannot create object of class Repository"
        
        self.path = path
        self.type = repotype
        self.projectname = projectname
        self._size = 0
        self._changelog = 0
    
    def connect(self):
        raise NotImplementedError("Subclasses should implement this!")
    
    def getChangesAndFiles(self, changeid, repoid, fromrev, torev):
        raise NotImplementedError("Subclasses should implement this!")
    
    def _processChange(self, ctx, changeid, repoid):
        raise NotImplementedError("Subclasses should implement this!")

    def _processChangeFiles(self, ctx, changeid):
        raise NotImplementedError("Subclasses should implement this!")
    
    def _extractFileExtension(self, filename):
        extension = os.path.splitext(filename)[1][1:].strip() 
        return extension
    
    def getSize(self):
        raise NotImplementedError("Subclasses should implement this!")
